﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s"  uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="<%=path%>/script/admin/jquery.js"></script>
<link rel="stylesheet"
	href="<%=path%>/script/ztree_3.3/css/zTreeStyle/zTreeStyle.css"
	type="text/css" />
<script type="text/javascript"
	src="<%=path%>/script/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/script/ztree_3.3/js/jquery.ztree.all-3.3.js"></script>
<script type="text/javascript" src="<%=path%>/script/admin/chili-1.7.pack.js"></script>
<script type="text/javascript" src="<%=path%>/script/admin/jquery.easing.js"></script>
<script type="text/javascript" src="<%=path%>/script/admin/jquery.dimensions.js"></script>
<script type="text/javascript" src="<%=path%>/script/admin/jquery.accordion.js"></script>
<script language="javascript">
	jQuery().ready(function(){
		jQuery('#navigation').accordion({
			header: '.head',
			navigation1: true, 
			event: 'click',
			fillSpace: true,
			animated: 'bounceslide'
		});
	});
	
	
	var setting = {
			data : {
				simpleData : { //simpleData表示这个一个简单的ztree树形结构（还有一种标准结构，具体查看Ztreeapi）
					enable : true
				}
			},
			callback: {
				onClick: function (event, treeId, treeNode) {
				  var isLeaf=treeNode.isLeaf;
				
				  if(isLeaf=="Y" || isleaf=="y"){
					  var href=treeNode.href;
					  //让右边的框架打开此链接
					  var topparent=window.parent; //拿到父窗口
					  var frameArray=topparent.frames; //拿到窗口的所有框架的集合
					  var rightFrame=frameArray["rightFrame"];  //拿到父窗口集合中的右边的框架
					  
					  rightFrame.location.href="${pageContext.request.contextPath}"+href;
					  
				  }
					
				}
			}
		};
	 <s:iterator value="#request.bigList" var="bigList">
			var loadURL="<%=path%>/mainAction!leftTree?menu_id=<s:property value="#bigList.MENU_ID"/>&date="+new Date()+"";
			$.get(loadURL, function(treeDate) {  //从数据库中取到json格式的数据（节点数据）返回给ztree使用。
				$.fn.zTree.init($("#treeDemo_<s:property  value="#bigList.MENU_ID"/>"), setting, treeDate); //把ztree树形结构按照setting的规则，节点为treeDate，加载到id为ztreeDemo的标签中
			}, "json");
	</s:iterator>
	
</script>
<style type="text/css">
<!--
body {
	margin:0px;
	padding:0px;
	font-size: 12px;
}
#navigation {
	margin:0px;
	padding:0px;
	width:147px;
}
#navigation a.head {
	cursor:pointer;
	background:url(images/main_34.gif) no-repeat scroll;
	display:block;
	font-weight:bold;
	margin:0px;
	padding:5px 0 5px;
	text-align:center;
	font-size:12px;
	text-decoration:none;
}
#navigation ul {
	border-width:0px;
	margin:0px;
	padding:0px;
	text-indent:0px;
}
#navigation>span {
	list-style:none; display:inline;
}
#navigation>span>a {
	display:block;
	font-size:12px;
	text-decoration: none;
	text-align:center;
	padding:3px;
}
#navigation>span>a:hover {
	background:url(images/tab_bg.gif) repeat-x;
		border:solid 1px #adb9c2;
}
-->
</style>
</head>
<body>
<div  style="height:100%;">
  <ul id="navigation">
  <s:iterator value="#request.bigList" var="bigList">
    <span> <a class="head"><s:property value="#bigList.menu_name"/></a>
      <ul>
        <div class="zTreeDemoBackground left" > 
			<ul id="treeDemo_<s:property  value="#bigList.MENU_ID"/>" class="ztree"></ul>
		</div>
      </ul>
    </span>
  
   </s:iterator>
  

  </ul>
</div>
</body>
</html>
